import 'dart:convert' show json;

class TangShi {

  int code;
  String msg;
  List<shi> newslist;

  TangShi.fromParams({this.code, this.msg, this.newslist});

  factory TangShi(jsonStr) => jsonStr == null ? null : jsonStr is String ? new TangShi.fromJson(json.decode(jsonStr)) : new TangShi.fromJson(jsonStr);

  TangShi.fromJson(jsonRes) {
    code = jsonRes['code'];
    msg = jsonRes['msg'];
    newslist = jsonRes['newslist'] == null ? null : [];

    for (var newslistItem in newslist == null ? [] : jsonRes['newslist']){
      newslist.add(newslistItem == null ? null : new shi.fromJson(newslistItem));
    }
  }

  @override
  String toString() {
    return '{"code": $code,"msg": ${msg != null?'${json.encode(msg)}':'null'},"newslist": $newslist}';
  }
}

class shi {

  String author;
  String content;
  String intro;
  String kind;
  String title;

  shi.fromParams({this.author, this.content, this.intro, this.kind, this.title});

  shi.fromJson(jsonRes) {
    author = jsonRes['author'];
    content = jsonRes['content'];
    intro = jsonRes['intro'];
    kind = jsonRes['kind'];
    title = jsonRes['title'];
  }

  @override
  String toString() {
    return '{"author": ${author != null?'${json.encode(author)}':'null'},"content": ${content != null?'${json.encode(content)}':'null'},"intro": ${intro != null?'${json.encode(intro)}':'null'},"kind": ${kind != null?'${json.encode(kind)}':'null'},"title": ${title != null?'${json.encode(title)}':'null'}}';
  }
}

